// pages/home/home.js
import { envChange} from '../../utils/api.js';
Component({
  //组件的属性可以直接在组件标签上定义
  properties: { 
  },
  data:{
    dev:false,
    currentEnv:'pro'
  },
  /**
   * 生命周期函数--监听页面加载
   */
  attached(options) {
    this.setData({dev:wx.getStorageSync('switch'),currentEnv:wx.getStorageSync('currentEnv')?wx.getStorageSync('currentEnv'):'pro'})   
  },
  methods:{
    chnageEnv(){
      if(this.data.currentEnv=='dev'){
        this.setData({
          currentEnv:'pro'
        })
        envChange('pro')
      }else{
        this.setData({
          currentEnv:'dev'
        })
        envChange('dev')
      }
      
    }
  }
})